<!--{include /service/service_head}-->

<div id="main-content">
		<!-- Main Content Section with everything -->

		<!-- Page Head -->
		<!-- End .clear -->
		<form action="/service/staffWorkTime.php" id="indexform" name="indexform" method="get">
		<div class="search_box clearfix">
			<label class="clearfix">
				<span>店舗：</span>
				<select name="shop_id" class="small-input">
				    <option value="0">選択してください</option>
				    ${Utility::Option(Utility::OptionArray($shopList, 'id', 'shop_name'), $defaultShopId)}
				</select>
			</label><br />
			<label class="clearfix">
				<span>登録開始時間：</span>
				<select name="time[startYear]" class="small-input">
				    <option value="0">選択してください</option>
				    ${Utility::CommonOption($yearList, $time['startYear'])}
				</select>
				<em>年</em>
				<select name="time[startMonth]" class="small-input">
				    <option value="0">選択してください</option>
				    ${Utility::CommonOption($monthList, $time['startMonth'])}
				</select>
				<em>月</em>
				<select name="time[startDay]" class="small-input">
    				<option value="0">選択してください</option>
					${Utility::CommonOption($dayList, $time['startDay'])}
  				</select>
				<em>日</em>
			</label><br />
			<label class="clearfix"><span>登録終了時間：</span>
				<select name="time[endDay]" class="small-input">
    				<option value="0">選択してください</option>
					${Utility::CommonOption($dayList, $time['endDay'])}
  				</select>
				<em>日</em>
			</label><br />
			<input type="submit" value="検索" class="button">
		</div>
		</form>
		<div class="content-box">
			<!-- Start Content Box -->
			<div class="content-box-header">
				<h3>勤務時間帯登録（スタッフ別）</h3>

				<ul class="content-box-tabs" style="display:none;">
					<li><a href="#tab1" class="default-tab">详细</a></li>
					<!-- href must be unique and match the id of target div -->
					<li><a href="#tab2">编辑</a></li>
				</ul>
				<div class="clear"></div>
			</div>
			<!-- End .content-box-header -->

			<div class="content-box-content">
				<div class="tab-content default-tab" id="tab1">
					<!-- This is the target div. id must match the href of this div's tab -->
					<div class="table_box">
						<table>
						<thead class="title_head">
							<tr>
								<th class="title">名前</th>
								<!--{loop $workDayList $index $one}-->
								<th class="title">
									{$one}日
									<!--{if $workDayofWeekList[$index] == "sat"}--> 
							      　		<font color="blue">({$workDayofWeekList[$index]})</font> 
							      　<!--{elseif $workDayofWeekList[$index] == "sun"}--> 
							      　		<font color="red">({$workDayofWeekList[$index]})</font> 
							      　<!--{else}--> 
							      　		({$workDayofWeekList[$index]}) 
							       <!--{/if}-->
								</th>
								<!--{/loop}-->
							</tr>
						</thead>
						<tbody>
							<!--{loop $staffList $index $one}-->
							<tr>
								<td>{$one['family_name']} {$one['personal_name']} </td>
								
								<form action="/service/addWorkTime.php" method="post" succ="test" name="addWorkTime">
								<input type="hidden" name="month" value="{$time['startMonth']}"/>
								<input type="hidden" name="year" value="{$time['startYear']}"/>
								<input type="hidden" name="staffId" value="{$one['id']}"/>
								<!--{loop $workDayList $index1 $one1}-->
								<td>
									<input type="hidden" name="day[]" value="{$one1}"/>
									<!--{if $workScheduleStaffId[$one['id']][$one1] != null}-->
									<select name="startHour_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
										<option value="0">--</option>
										${Utility::CommonOption( $hourList, date('H',$workScheduleStaffId[$one['id']][$one1]['start_time']) )}
									</select>
							        <select name="startMinute_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $minuteList, date('i',$workScheduleStaffId[$one['id']][$one1]['start_time']) )}
							        </select>
							        <select name="endHour_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $hourList, date('H',$workScheduleStaffId[$one['id']][$one1]['end_time']) )}
							        </select>
							        <select name="endMinute_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $minuteList, date('i',$workScheduleStaffId[$one['id']][$one1]['end_time']) )}
							        </select>
							        <!--{else}-->
							        <select name="startHour_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $hourList, 0 )}
							        </select>
							        <select name="startMinute_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $minuteList, 0 )}
							        </select>
							        <select name="endHour_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $hourList, 0 )}
							        </select>
							        <select name="endMinute_{$one['id']}[]" onchange="copy2Next({$time['startDay']}, {$one1}, this)">
								        <option value="0">--</option>
										${Utility::CommonOption( $minuteList, 0 )}
							        </select>
							        <!--{/if}-->
								</td>
								<!--{/loop}-->
								<td><input type="submit" value="登録" class="button"></td>
								</form>
							</tr>
							<!--{/loop}-->
						</tbody>
					</table>
					</div>
					<div style="display:none;">
					<table>
							<tr>
								<td colspan="7"><div class="pagination"> <a href="#" title="First Page">&laquo; First</a><a href="#" title="Previous Page">&laquo; Previous</a> <a href="#" class="number" title="1">1</a> <a href="#" class="number" title="2">2</a> <a href="#" class="number current" title="3">3</a> <a href="#" class="number" title="4">4</a> <a href="#" title="Next Page">Next &raquo;</a><a href="#" title="Last Page">Last &raquo;</a> </div>

									<!-- End .pagination -->
									<div class="clear"></div></td>
							</tr>
							</table>
					</div>
				</div>
			</div>
			<!-- End .content-box-content -->
		</div>

		<!-- End .content-box -->
		<!-- End .content-box -->
		<!-- End .content-box -->
		<div class="clear"></div>
		<!-- Start Notifications -->
		<!-- End Notifications -->
		<div id="footer"> <small>
			<!-- Remove this notice or replace it with whatever you want -->

			&#169; Copyright 2011 川崎エステ　エレガントリゾート　すべての女性を美しく幸せに | Powered by <a href="#">ZHONGHUA</a> | <a href="#">Top</a> </small> </div>
		<!-- End #footer -->
	</div>
	<!-- End #main-content -->
</div>

</body>
<!-- Download From www.exet.tk-->
</html>


<script type="text/javascript"> 
function test(val){
	val = eval("(" +  val + ")");
	if( val.error == 0 ){
		alert( "追加しました" );
	}else{
		alert(val.data);
	}
}

function copy2Next(judgeDay, currentDay, obj){
	if( currentDay != judgeDay ){
		return ;
	}
	var objName = $(obj).attr('name');
	$(obj).parents('tr').find("select[name='" + objName + "']").val( $(obj).val() );
	
	
}
	jQuery(function(){
		$("select[name='shop_id']").bind("change", function(){
			
			$("#indexform").submit();
		});
		new AjaxFormManager($("form[name='addWorkTime']"));
	});
</script>
</html>
